#include"Vector.hpp"
#include<iostream>
#include<vector>

using namespace std;



 void test_std_vector(){
 std::vector<int> v1;                                               
  cout<<v1.size()<<endl<<v1.capacity()<<endl;
 
  v1.push_back(1);
  v1.push_back(1);
  v1.push_back(1);
  v1.push_back(1);
  v1.push_back(1);
  v1.push_back(1);

  v1.insert(v1.begin()+3,5);
  for(auto&it:v1){
    cout<<it<<" ";
  }
  cout<<endl;
 }


namespace MyVector{
  void test_Mvector_insert(){
    vector<int>vv;
    vv.push_back(1);
    vv.push_back(1);
    vv.push_back(1);
    vv.push_back(1);
    vv.push_back(1);
    vv.push_back(1);
    vv.insert(vv.begin()+3,5);
    
    for(auto&it:vv){
      std:: cout<<it<<" ";
    }
    cout<<std::endl;

    vector<int>v2;
    v2.push_back(3);
    v2.push_back(3);
    v2.push_back(3);
    v2.push_back(3);
    v2.push_back(3);
    v2.push_back(3);
    for(auto&it:v2){
      std:: cout<<it<<" ";
    }
    cout<<std::endl;

    vv.swap(v2);

    for(auto&it:vv){
      std:: cout<<it<<" ";
    }
    cout<<std::endl;
    for(auto&it:v2){
      std:: cout<<it<<" ";
    }
    cout<<std::endl;
 
    v2.insert(v2.begin(),6);
    for(auto&it:v2){
      std:: cout<<it<<" ";
    }
    cout<<std::endl;

    v2.insert(v2.end(),3,5);
    for(auto&it:v2){
      std:: cout<<it<<" ";
    }
    cout<<std::endl;
  } 
    
   void test_MVector_resize()
   {
      MyVector::vector<int> v1;
      v1.push_back(2);
      v1.push_back(2);
      v1.push_back(2);
      v1.push_back(2);
      v1.push_back(2);
      v1.push_back(2);
      v1.push_back(2);


    for(auto&it:v1){
      std:: cout<<it<<" ";
    }
    cout<<std::endl;

    v1.resize(3);

    for(auto&it:v1){
      std:: cout<<it<<" ";
    }
    cout<<std::endl;

    v1.resize(10,6);
    for(auto&it:v1){
      std:: cout<<it<<" ";
    }
    cout<<std::endl;
   }

class Solution {
public:
    vector<vector<int>> generate(int numRows) {
        vector<vector<int>>triangle(numRows);
        for(int i = 0;i<numRows;i++){
            triangle[i].resize(i+1,0);
            triangle[i].front() = triangle[i].back() = 1;
        }
        for(int i = 0;i<numRows;i++){
            for(size_t j = 0;j<triangle[i].size();j++){
                if(triangle[i][j]!=1){
                    triangle[i][j] = triangle[i-1][j-1]+triangle[i-1][j];
                }
            }
        }
        
        return triangle;
    }
};
   void test_MVectro_PT(){
      Solution sl;
     auto triangle = sl.generate(5);

      for(size_t i =0;i<triangle.size();i++){
        for(size_t j =0;j<triangle[i].size();j++){
          cout<<triangle[i][j]<<" ";
        }
      }
   }
}


  int main()
  {
  // test_std_vector();
   cout<<endl;
  //MyVector::test_Mvector_insert();
  
   MyVector::test_MVector_resize();
   
  // MyVector::test_MVectro_PT();
    return 0;
  }
